﻿using Microsoft.AspNetCore.Mvc;
using PowerHub.MES.Common.Utility;
using PowerHub.MES.DTO.ProcessRoute.DTO;
using PowerHub.MES.DTO.ProcessRoute.QueryDto;
using PowerHub.MES.Entities.ProcessRoute;
using PowerHub.MES.IServices.IProcessRoute;
using PowerHub.MES.ReturnEntity;

namespace PowerHub.MES.Controllers.ProcessRoute
{
    /// <summary>
    /// 工序
    /// </summary>
    [ApiController]
    [Route("Api/MES/ProcessRoute/[controller]/[action]")]
    public class ProcessController
    {

        private IProcessRoute_ProcessServices _ProcessRoute_ProcessServices;

        public ProcessController(IProcessRoute_ProcessServices ProcessServices)
        {
            _ProcessRoute_ProcessServices = ProcessServices;
        }

        /// <summary>
        /// 获取工序列表
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("获取工序列表")]
        public async Task<OperationPageResult<List<ProcessRoute_Process>>> GetProcessRoute_ProcessPageListAsync([FromBody] QueryProcessRoute_ProcessDTO pageQuery)
        {
            return await _ProcessRoute_ProcessServices.GetProcessRoute_ProcessPageListAsync(pageQuery);
        }


        /// <summary>
        /// 批量删除工序
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("批量删除工序")]
        public async Task<OperationResult<object>> DeletionProcessRoute_ProcessAsync([FromBody] List<string> Query)
        {
            return await _ProcessRoute_ProcessServices.DeletionProcessRoute_ProcessAsync(Query);
        }

        /// <summary>
        /// 更新工序
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("更新工序")]
        public async Task<OperationResult<object>> UpdateProcessRoute_ProcessAsync([FromBody] ProcessRoute_ProcessDTO Query)
        {
            return await _ProcessRoute_ProcessServices.UpdateProcessRoute_ProcessAsync(Query);
        }

        /// <summary>
        /// 添加工序
        /// </summary>
        /// <returns></returns>
        /// <exception cref="Exception"></exception>
        [HttpPost]
        [FunctionDescription("添加工序")]
        public async Task<OperationResult<object>> CreateProcessRoute_ProcessAsync([FromBody] ProcessRoute_ProcessDTO Query)
        {
            return await _ProcessRoute_ProcessServices.CreateProcessRoute_ProcessAsync(Query);
        }
    }
}
